package com.whz.gateway.user;

import com.whz.generic.spring.SpringUtils;

/**
 * 用户信息详情查询
 *
 * @author whz
 */
@FunctionalInterface
public interface UserDetailWrapper {

    /**
     * 查询用户详情
     *
     * @param accessToken 用户登录access token
     * @return 用户详情
     */
    UserDetailInfo getUserDetail(String accessToken);

    /**
     * 返回当前用户详情查询类的bean
     *
     * @return {@link UserDetailWrapper}
     */
    static UserDetailWrapper getInstance() {
        return SpringUtils.getBean(UserDetailWrapper.class).orElseThrow(() -> new RuntimeException("未注册UserDetailWrapper类型"));
    }
}